<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:79:"/home/wwwroot/www.lxlhome.com/public/../application/admin/view/login/login.html";i:1555270168;s:71:"/home/wwwroot/www.lxlhome.com/application/admin/view/common/header.html";i:1555692011;}*/ ?>
<!doctype html>
<html  class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>后台登陆-LXL</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" href="/static/admin/css/font.css">
    <link rel="stylesheet" href="/static/common/css/public.css">
    <link rel="stylesheet" href="/static/common/lib/layui/css/layui.css">
    <link rel="stylesheet" href="/static/admin/css/xadmin.css">
    <script type="text/javascript" src="/static/common/jq/jquery.min.js"></script>
    <script type="text/javascript"src="/static/common/lib/md5/md5.min.js"></script>
    <script src="/static/common/lib/layui/layui.js" charset="utf-8"></script>

    <script type="text/javascript" src="/static/admin/js/xadmin.js"></script>
    <script type="text/javascript" src="/static/admin/js/cookie.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="/static/common/lib/ie/html5.min.js"></script>
    <script src="/static/common/lib/ie/respond.min.js"></script>
    <![endif]-->
    <script>
        // 是否开启刷新记忆tab功能
        // var is_remember = false;
    </script>
</head>
<body>
<body class="login-bg">

<div class="login layui-anim layui-anim-up">
    <div class="message">LXL博客-管理登录</div>
    <div id="darkbannerwrap"></div>

    <form class="layui-form">
        <div class="layui-form-item">
            <input name="username" placeholder="用户名" type="text" lay-verify="required" class="layui-input">
        </div>
        <div class="layui-form-item">
            <input name="password" lay-verify="required" placeholder="密码" type="password" class="layui-input">
        </div>
        <div class="layui-form-item">
                <input name="code" placeholder="验证码" maxlength="4" style="width: 150px; display:inline; float:left; letter-spacing:0.5em; font-size:20px;" type="text" class="layui-input">
                <img id="captcha" src="<?php echo captcha_src(); ?>" alt="captcha"  style="float:right;cursor: pointer;" onclick="this.src='<?php echo captcha_src(); ?>?'+Math.random();" />

        </div>
        <div class="layui-form-item">
            <input value="登录" lay-submit lay-filter="login" style="width:100%;" type="submit">
        </div>
    </form>
</div>

<script>
    $(function () {
        layui.use('form', function () {
            var form = layui.form;

            form.verify({
                username: function (value, item) { //value：表单的值、item：表单的DOM对象
                    if (!new RegExp("^[a-zA-Z0-9_\u4e00-\u9fa5\\s·]+$").test(value)) {
                        return '用户名不能有特殊字符';
                    }
                    if (/(^\_)|(\__)|(\_+$)/.test(value)) {
                        return '用户名首尾不能出现下划线\'_\'';
                    }
                    if (/^\d+\d+\d$/.test(value)) {
                        return '用户名不能全为数字';
                    }
                }

                //我们既支持上述函数式的方式，也支持下述数组的形式
                //数组的两个值分别代表：[正则匹配、匹配不符时的提示文字]
                , pass: [
                    /^[\S]{6,12}$/
                    , '密码必须6到12位，且不能出现空格'
                ]
            });
            form.on('submit(login)', function (data) {
                $.ajax({
                    url: "<?php echo url('doLogin'); ?>"
                    , data: {data: data.field}
                    , dataType: 'json'
                    , type: 'post'
                    , success: function (res) {
                        if (0 === res.code) {
                            layer.msg(res.msg, {icon: 6}, function () {
                                window.location.href = res.url;
                            });
                        } else {
                            layer.msg(res.msg, {icon: 5});
                            $('input[name="code"]').val('');
                            $('#captcha').attr('src','<?php echo captcha_src(); ?>?'+Math.random());
                        }
                    }
                });
                return false;
            });
        });
    })


</script>


<!-- 底部结束 -->
</body>
</html>